package yunquan.wang.modules.base.entity;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import yunquan.wang.base.domain.IdEntity;
@Entity
@Table(name = "BASE_ROLES_AUTHORITY")
public class RolesAuthority extends IdEntity {
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ROLESINFO_ID")
	private Rolesinfo rolesinfo;//角色信息
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "AUTHORITY_ID")
	private Authority authority;//权限信息
    @ManyToMany(cascade = CascadeType.REFRESH,fetch=FetchType.EAGER)  
    @JoinTable(name = "BASIC_ROLES_AUTHORITY_RULES", inverseJoinColumns = @JoinColumn(name = "RULES_ID"), joinColumns = @JoinColumn(name = "ROLES_AUTH_ID"))  
	private Set<RulesInfo> rulesInfos;//权限的规则信息
	public Rolesinfo getRolesinfo() {
		return rolesinfo;
	}
	public void setRolesinfo(Rolesinfo rolesinfo) {
		this.rolesinfo = rolesinfo;
	}
	public Authority getAuthority() {
		return authority;
	}
	public void setAuthority(Authority authority) {
		this.authority = authority;
	}
	public Set<RulesInfo> getRulesInfos() {
		return rulesInfos;
	}
	public void setRulesInfos(Set<RulesInfo> rulesInfos) {
		this.rulesInfos = rulesInfos;
	}
     
	
}
